package com.example.minisqlite;

import java.sql.SQLException;

/**
 * SQL执行器：解析SQL并调用引擎完成具体操作。
 */
public class SqlExecutor {

    private final Engine engine;
    private final SqlParser parser = new SqlParser();

    public SqlExecutor(Engine engine) {
        this.engine = engine;
    }

    public ResultSet execute(String sql) throws SQLException {
        Statement stmt = parser.parse(sql);
        return stmt.execute(engine);
    }
}
